GO:=go
OS:=linux
ARCH?=arm64
TARGET:=dev_gw
VERSION:=V1.0.3
GO_SRC := ./src/main
GO_FILE := $(wildcard ${GO_SRC}/main.go)

LOG_FILE:=dev_gw.log

# print:
# 	@echo $(GO_FILE)

LDFLAGS:="-X 'dev_gw/common.Version=${VERSION}' -X 'dev_gw/logger.LoggerFile=${LOG_FILE}'" 

all : clean ${TARGET} 

${TARGET} :
	@GOOS=${OS} GOARCH=${ARCH} ${GO} build -ldflags=${LDFLAGS} -o $@ ${GO_FILE} 

clean :
	@-rm -rf ${TARGET}

install :
	sshpass -p root scp ${TARGET} root@192.168.8.180:/apps/dev_gw/
	# adb push dev_gw /apps/dev_gw/

x86: 
	GOOS=${OS} ${GO} build -ldflags=${LDFLAGS} -o ${TARGET} ${GO_FILE}

.PHONY : all clean install








